#coding:utf-8
import pickle
from selenium import webdriver
firefox=webdriver.Firefox()
cookies = pickle.load(open("xg", "rb"))
firefox.get("https://www.youtube.com")
for cook in cookies:
    firefox.add_cookie(cook)
firefox.refresh()